package com.wangyadong.hobby.metric.metricset;

import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/12/1915:07
 **/
public class Application {
    private static final MetricRegistry metricRegistry = new MetricRegistry();
    private static final JmxReporter reporter = JmxReporter
            .forRegistry(metricRegistry)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.SECONDS)
            .build();

    public static void main(String[] args) throws InterruptedException {
        reporter.start();
        Busniess busniess = new Busniess();
        metricRegistry.registerAll(busniess);
        busniess.start();
        Thread.currentThread().join();
    }
}
